package Notepad;

import java.util.Scanner;


public class SecureNotepad extends  SimpleNotepad implements ISecureNotepad
{
	public SecureNotepad(int numberOfPages, final String password) {
	
		super(numberOfPages);
		this.password = password;
		
	}
	private final String password;
	@Override
	public boolean askForPassword() {
		String password;
		
		Scanner sc = new Scanner(System.in);
		System.out.println("Enter password");
		password = sc.next();
		
		return password.equals(this.password);
	}
	public void addText(int pageNumber, String text)
	{
		if(askForPassword())
			super.addText(pageNumber, text);
	}
	public void deleteText(Page selectedPage) {
		if(askForPassword())
			super.deleteText(selectedPage);
	}
	public void LookThroughThePage()
	{
		if(askForPassword())
			super.LookThroughThePage();
	}
	public void replaceText(int page, String newText)
	{
		if(askForPassword())
			super.replaceText(page, newText);
	}
	

	
}
